﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Appsters
{
    public partial class profView : Form
    {
        public profView()
        {
            InitializeComponent();
            DateTime dt = DateTime.Now;
            date.Text = dt.ToString("d");
        }

        private void Form3_Load(object sender, EventArgs e)
        {
            //set picture of picturebox
            string docPath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string prof = System.IO.Path.Combine(docPath, "Jotter\\Display Picture\\Profile.jpeg");
            profBox.Image = Image.FromFile(prof);

            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
            gp.AddEllipse(0, 0, profBox.Width - 3, profBox.Height - 3);
            Region rg = new Region(gp);
            profBox.Region = rg;

            //read from text files
            System.IO.StreamReader reader = new System.IO.StreamReader(System.IO.Path.Combine(docPath, "Jotter\\Saved Files\\Log In Details\\Name.txt"));
            System.IO.StreamReader reader2 = new System.IO.StreamReader(System.IO.Path.Combine(docPath, "Jotter\\Saved Files\\Log In Details\\Description.txt"));

            //set name in textbox
            nameBox.Text = reader.ReadLine();

            //set desc in textbox
            descBox.Text = reader2.ReadLine();

            //close all readers
            reader.Close();
            reader2.Close();
        }

        private void exit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void goToNotes_Click(object sender, EventArgs e)
        {
            //go to Notes Form
            notes p = new notes();
            p.Show();
            this.Hide();
        }

        private void min_Click(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Minimized;
        }

        private void goToPlanner_Click(object sender, EventArgs e)
        {
            //go to Monthly View
            planner p = new planner();
            p.Show();
            this.Hide();
        }

        private void profBox_Click(object sender, EventArgs e)
        {
            //search photo
        }

    }
}
